<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>提现</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
<link href="{$Think.config.RESOURCEURL}wx_assets/quan/cash.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
</head>
<body>
<div class="success" id="success">
    <div class="ico"></div>
    <div class="msg">
        提现申请已提交，最快一个工作日内即可到账。<br/>
        <span>预计到账日期：{$endDate}</span><br/>
        <a href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=quan&method=getBalanceList&params=%7B%22qId%22%3A%22{$qId}%22%2C%22uType%22%3A%22{$uType}%22%2C%22tType%22%3A%223%22%7D'>查看申请记录</a>
    </div>
</div>
<div class="page" id="page">
    <div class="box" id="box">
        <div class="left">
        金额（元）
        </div>
        <div class="input-box">
            <input class="text_input" placeholder="账户余额&nbsp;&nbsp;<php> echo sprintf("%.2f", $miCoins);</php>" id="cashNum" type="tel" value="" maxlength="4" />
        </div>
    </div>
    <a id="BtnOk" class="btn-red">提交申请</a>
    <div class="info-box">
      <span>提现须知：</span>
      <br>
        1、  提现渠道：密友的所有提现均通过【微信转账】形式发放；<br>
        2、  可提现金额：提现金额应小于或等于可提现金额；<br>
        3、  提现金额限制：每次提现的额度需大于等于10元；<br>
        4、  处理时间：1-2个工作日内。<br>
    </div>
</div>
<script>
    var baseUrl = '{$Think.config.SERVER_HOST}';
    var cash={
        init:function(){
            this._initValidate();
        },
        /**
         * [_saveSubmit 保存提现]
         * @return {[type]} [description]
         */
        _saveSubmit:function(){
            $.req.get("call.json?module=quan&customerId={$customerId}&method=saveCash",{
                userName:"{$userName}",
                params:{
                    "qId":"{$qId}",
                    "cashNum":$("#cashNum").val(),
                    "uType":"{$uType}"
                }
            },function(data){
                if(!data.code) {
                    $("#success").show();
                    $("#page").hide();
                } else {
                    $.util.alert(data.msg);
                }
            });
        },
        _initValidate:function(){
            var me = this;
            var config = {};
            var max={$miCoins};
            config = {
                "cashNum": {
                    rule: {
                        required: {
                            message: "请输入提现金额！"
                        },
                        num: {
                            message: "提现金额错误!"
                        },
                        m100:{
                            param:function(v){
                                if(v){
                                    if(v && v%10==0){
                                        return true;
                                    } else {
                                        return false;
                                    }
                                }
                            },
                            message: "提现金额必须为10的整数倍!"
                        },
                        max:{
                            param:function(v){
                                return v && parseFloat(v)<=max;
                            },
                            message: "提现金额超出账户余额!"
                        }
                    },
                    pos: "bottom"
                }
            }
            var va = new Validate("box", config);
            $("#BtnOk").click(function() {
                va.validate(function(result) {
                    if (result) {
                        me._saveSubmit();
                    }
                });
            });
        }
    }
    cash.init();
     wx_share.init({
        "pkg":{
            "appId": '{$pkg.appId}',
            "timestamp": {$pkg.timestamp},
            "nonceStr": '{$pkg.nonceStr}',
            "signature": '{$pkg.signature}'
        },
        hide:1
    });
</script>
</body>
</html>